﻿using System;
using System.IO;

namespace BulkUploadGovernanceFiles
{
    public class SimpleLogging
    {
        private readonly string _filePath;
        private StreamWriter _log;

        public SimpleLogging()
        {
            SimpleLoggingNameStrategy.FileName fileName = new SimpleLoggingNameStrategy.FileName(new SimpleLoggingNameStrategy.IncrementalName());
            _filePath = fileName.Name("log.txt");
            _log = new StreamWriter(_filePath);
            _log.Close();
        }

        public void Log(string message)
        {
            _log = File.AppendText(_filePath);
            _log.WriteLine(DateTime.UtcNow + " " + message);
            _log.Close();
        }
    }
}
